<div id="wrapper">
	<!--左侧导航开始-->
	<?=\app\widgets\MenuWidget::widget();?>
	<!--左侧导航结束-->
	<!--右侧部分开始-->
	<div id="page-wrapper" class="gray-bg dashbard-1">
		<?=$this->render('@app/modules/admin/views/layouts/inc_naver');?>
		<div class="wrapper wrapper-content animated fadeInRight">
			<div class="row">
				<div class="col-sm-12">
					<div class="ibox float-e-margins">
						<div class="ibox-title">
							<h5>用户列表</h5>
						</div>
						<div class="ibox-content">
							<div class="row">
								<form id="searchForm" class="" name="searchForm" action="" method="get">
									<div class="col-sm-3">
										<div class="input-group">
											<input type="text" placeholder="请输入用户名称" class="input-sm form-control" name="userName" value="<?php echo isset($userName) ? $userName : '';?>">
											<span class="input-group-btn">
												<button type="submit" class="btn btn-sm btn-primary"> 搜索</button>
											</span>
										</div>
									</div>
									<div class="form-group">
										<a href="/admin/admin/create" class="btn btn-primary"><i class="icon icon-plus"></i> 新增用户</a>
									</div>
								</form>
							</div>
							<div class="table-responsive">
								<form method="post" action="" name="logDataForm" id="logDataForm" class="form-inline">
									<table class="table table-striped">
										<thead>
										<tr>
											<th>ID</th>
											<th>用户名称</th>
											<th>用户组</th>
											<th>邮箱</th>
											<th>真实姓名</th>
											<th>激活状态</th>
											<th>操作</th>
										</tr>
										</thead>
										<tbody>
										<?php foreach ($dataList as $data):?>
										<tr data-id="3434">
											<td><?php echo $data['id'];?></td>
											<td><?php echo $data['userName'];?></td>
											<td><?php echo $data['groupName'];?></td>
											<td><?php echo $data['email'];?></td>
											<td><?php echo $data['realName'];?></td>
											<td><?php echo $data['statusIs'] == 1 ? '激活' : '未激活';?></td>
											<td>
												<a href="/admin/admin/create?id=<?php echo $data['id']?>">编辑</a>
												<a href="#" onclick="deleteAct(<?php echo $data['id']; ?>)">删除</a>
											</td>
										</tr>
										<?php endforeach;?>
										</tbody>
									</table>
								</form>
								<?=\yii\widgets\LinkPager::widget([
                                    'pagination'         => $pages,
                                    'firstPageLabel'     => '首页',
                                    'lastPageLabel'      => '尾页',
                                    'pageCssClass'       => 'paginate_button',
                                    'activePageCssClass' => 'paginate_active',
                                ]);?>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
	<!--右侧部分结束-->
</div>
<script src="/static/js/jquery.min.js?v=2.1.4"></script>
<script src="/static/js/bootstrap.min.js?v=3.3.6"></script>
<script src="/static/js/plugins/peity/jquery.peity.min.js"></script>
<script>
	deleteAct = function (id) {
		if (!confirm('是否确认删除？')) return false;
		var csrfToken = $('meta[name="csrf-token"]').attr("content");
		var param = { id: id,_csrf:csrfToken };
		var url = '/admin/admin/delete';
		getData('POST', url, param, 'json', function (data) {
			if (data.code == 1000) {
				window.location.reload();
			} else {
				alert(data.message);
				return false;
			}
		});
	};

	getData = function (type, url, param, datatype, callback) {
		$.ajax({
			type: type,
			url: url,
			data: param,
			dataType: datatype,
			success: callback
		});
	};
</script>